package com.spzx.product.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.product.api.RemoteProductService;
import com.spzx.product.api.vo.ProductSkuVo;
import com.spzx.product.api.vo.SkuPriceVo;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;

/**
 * @author LOGIN
 * @title RemoteProductFallbackFactory
 * @create 2025/7/26 10:34
 * @description
 */

// todo  实现 Feign 客户端的降级处理逻辑
public class RemoteProductFallbackFactory implements FallbackFactory<RemoteProductService> {
    @Override
    public RemoteProductService create(Throwable cause) {
        return new RemoteProductService() {
            @Override
            public R<ProductSkuVo> getproductSku(Long skuId,String  source) {
                return R.fail("获取商品SKU信息失败" + cause.getMessage());
            }

            @Override
            public R<List<SkuPriceVo>> getSkuPriceList(List<Long> skuIdList, String source) {
                return R.fail("批量获取商品sku最新价格信息失败" + cause.getMessage());
            }

        };
    }
}
